import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { GrowVO, GrowForm, GrowQuery } from '@/api/farm/chicken/grow/types';

/**
 * 查询成长记录列表
 * @param query
 * @returns {*}
 */

export const listGrow = (query?: GrowQuery): AxiosPromise<GrowVO[]> => {
  return request({
    url: '/farm/chicken/grow/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询成长记录详细
 * @param id
 */
export const getGrow = (id: string | number): AxiosPromise<GrowVO> => {
  return request({
    url: '/farm/chicken/grow/' + id,
    method: 'get'
  });
};

/**
 * 新增成长记录
 * @param data
 */
export const addGrow = (data: GrowForm) => {
  return request({
    url: '/farm/chicken/grow',
    method: 'post',
    data: data
  });
};

/**
 * 修改成长记录
 * @param data
 */
export const updateGrow = (data: GrowForm) => {
  return request({
    url: '/farm/chicken/grow',
    method: 'put',
    data: data
  });
};

/**
 * 删除成长记录
 * @param id
 */
export const delGrow = (id: string | number | Array<string | number>) => {
  return request({
    url: '/farm/chicken/grow/' + id,
    method: 'delete'
  });
};
/**
 * 默认标题
 */
export const defaultTitle = () => {
  return request({
    url: `/farm/chicken/grow/title`,
    method: 'get'
  });
};
/**
 * 审核操作
 * @param data
 */
export const auditChickenGrowApi = (data: any) => {
  return request({
    url: `/farm/chicken/grow/audit`,
    method: 'put',
    data: data
  });
};
